/******************************************************************
 *
 * 	Programmer:		Brandon Shouse
 * 	Class:			CS362-400
 * 	Assignment:		Assignment 3
 *
 * 	Description: Unit Test for the isGameOver() function
 *
 *****************************************************************/

#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

int main() 
{
	struct gameState state;
	int numPlayer = 2;
	int p, r, i, test;
	int seed = 1000;
	int k[10] = {adventurer, council_room, feast, gardens, mine, 
		remodel, smithy, village, baron, great_hall};

	memset(&state, 23, sizeof(struct gameState));
	r = initializeGame(numPlayer, k, seed, &state);
	
	printf("Testing isGameOver()...\n");

	//Test Game is not over
	test = isGameOver(&state);
	assert (test == 0);
	printf("\tGame not over: Passed\n");

	//Test Game is over when Provinve supply is 0
	state.supplyCount[province] = 0;
	test = isGameOver(&state);
	assert (test == 1);
	printf("\tGame over when Province count is 0: Passed\n");
	state.supplyCount[province] = 1;
	test = 0;

	//Test Game is over when 3 supply is 0
	state.supplyCount[adventurer] = 0;
	state.supplyCount[mine] = 0;
	state.supplyCount[smithy] = 0;
	test = isGameOver(&state);
	assert (test == 1);
	printf("\tGame over when 3 supply counts are 0: Passed\n");

	printf("isGameOver() passed all tests...\n");

	return 0;
}
